.TH std::ranges::drop_view::size 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::ranges::drop_view::size \- std::ranges::drop_view::size

.SH Synopsis
   constexpr auto size() requires ranges::sized_range<V>;             \fB(1)\fP \fI(since C++20)\fP
   constexpr auto size() const requires ranges::sized_range<const V>; \fB(2)\fP \fI(since C++20)\fP

   Returns the number of elements.

   Let base_ be the underlying view, count_ be the stored count (usually the number
   passed to the constructor, or 0 if *this is default constructed). Equivalent to

 const auto s = ranges::size(base_);
 const auto c = static_cast<decltype(s)>(count_);
 return s < c ? 0 : s - c;

.SH Parameters

   \fI(none)\fP

.SH Return value

   The number of elements.

.SH Example


// Run this code

 #include <array>
 #include <ranges>

 int main()
 {
     constexpr std::array a{42, 43, 44};
     static_assert(std::ranges::drop_view{std::views::all(a), 0}.size() == 3);
     static_assert(std::ranges::drop_view{std::views::all(a), 1}.size() == 2);
     static_assert(std::ranges::drop_view{std::views::all(a), 2}.size() == 1);
     static_assert(std::ranges::drop_view{std::views::all(a), 3}.size() == 0);
     static_assert(std::ranges::drop_view{std::views::all(a), 4}.size() == 0);
 }

.SH See also

   ranges::size  returns an integer equal to the size of a range
   (C++20)       (customization point object)
   ranges::ssize returns a signed integer equal to the size of a range
   (C++20)       (customization point object)
